import request from "@/utils/request"

export const addForum = (data) => {
  return request({
    url: '/forum',
    method: 'post',
    data
  })
}

export const getForumList = (data) => {
  return request({
    url: '/forum',
    method: 'get',
    data
  })
}

export const forumDetail = (id, uid) => {
  return request({
    url: `/forum/detail?id=${id}&uid=${uid}`,
    method: 'get'
  })
}

export const getForumComment = (data) => {
  return request({
    url: '/forum/comment',
    method: 'get',
    data
  })
}

export const addForumComment = (data) => {
  return request({
    url: '/forum/comment',
    method: 'post',
    data
  })
}

export const delComment = (id) => {
  return request({
    url: `/forum/comment/${id}`,
    method: 'delete'
  })
}

export const plusViews = (id, uid) => {
  return request({
    url: `/forum/views`,
    method: 'put',
    data: {
      id,
      uid
    }
  })
}

export const forumLikes = (fid, uid) => {
  return request({
    url: '/forum/likes',
    method: 'put',
    data: {
      fid,
      uid
    }
  })
}